<?php
// This class is used for connecting and querying the FlickR database.

class FlickR
{
    private $apiKey = 'c5004103a64815cbe42cb9bd439b4e20';

    public function __construct()
    {
    }

    public function search($query = null)
    {
        $search = 'http://flickr.com/services/rest/?method=flickr.photos.search&api_key='
            . $this->apiKey . '&tags=' . urlencode($query) . '&tag_mode=all&per_page=20&format=php_serial';
        //        var_dump($search);
        $result = file_get_contents($search);
        $result = unserialize($result);
        $total_num = $result['photos']['total'];
        return $total_num;
    }
}

?>